package com.sikeda.imagecomposetool.custom;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ImageView;

/**
 * Created by zhanghewei on 16/11/28.
 */

public class CustomImageView extends ImageView {
    public CustomImageView(Context context) {
        super(context);
    }

    public CustomImageView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public CustomImageView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
//        int h = (AppConfig.Divce_Width - 30) / 3;
        int h = this.getMeasuredHeight();
        int w = this.getMeasuredWidth();
        int spec = Math.max(h, w);
        setMeasuredDimension(spec, spec);
    }
}
